<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优惠券派送</title>
    <link rel="stylesheet" href="/Public/css/bootstrap.min.css">
    <link rel="stylesheet" href="/Public/css/gxxjkefu-normalize.css">
    <link rel="stylesheet" href="/Public/css/model.css">
    <link href="/Public/css/animate.css" rel="stylesheet">
</head>
<body>
<div id="main_C">
    <span>选择优惠券</span>
    <div class="input-group-btn">

        <select id="coupon" name="type" class="form-control"
                style="width: 100px;color: #959595;background: #eeeeee;border-bottom-left-radius: 3px;border-top-left-radius: 3px;">
            <option value="7">亲亲券</option>
        </select>
    </div>

    <span>选择面额</span>
    <div class="input-group-btn">

        <select id="money" name="type" class="form-control"
                style="width: 100px;color: #959595;background: #eeeeee;border-bottom-left-radius: 3px;border-top-left-radius: 3px;">
            <option value="1">10</option>
            <option value="2">20</option>
            <option value="3">30</option>
            <option value="4">40</option>
            <option value="5">50</option>
            <option value="6">60</option>
        </select>
    </div>
    <button style="" class="btn btn-info" id="search_submit" onclick="send_coupon()">派送</button>
</div>

<script src="/Public/js/jquery-3.2.1.js"></script>
<script src="/Public/js/layer/layer.js"></script>
<script src="/Public/js/layui/layui.js"></script>

<script>
    function send_coupon() {
        var money=  $("#money").find("option:selected").text();
        var phone="<{$phone}>";
        console.log('111111111', phone);
        if (phone == "" || phone == null) {
            $('#action').toast({
                content: '没有选择用户！',
                duration: 1000
            });
            return false;
        }
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var url = "<{$SERVER_NAME}>/User/coupon_send";

        layer.alert("确定赠送", {title: '提示框', icon: 3}, function (index) {
            $.post(url, {phone: phone}, function (data) {
                if (data.code == "1001") {
                    $('#action').toast({
                        content: '赠送成功！',
                        duration: 1000
                    });
                } else {
                    layer.alert(data.result);
                }
            });
            layer.close(index);
        });
        layer.close(index);

    }


</script>



</body>
</html>